<script src="<?php echo base_url() ?>commons/tablas/media/js/jquery.js" type="text/javascript"></script>
<script src="<?php echo base_url() ?>commons/tablas/media/js/jquery.dataTables.js" type="text/javascript"></script>
<script src="<?php echo base_url() ?>commons/tablas/extras/TableTools/media/js/ZeroClipboard.js" type="text/javascript"></script>
<script src="<?php echo base_url() ?>commons/tablas/extras/TableTools/media/js/TableTools.js" type="text/javascript"></script>

<style type="text/css" title="currentStyle">
            @import "<?php echo base_url() ?>commons/tablas/media/css/demo_page.css";
            @import "<?php echo base_url() ?>commons/tablas/media/css/demo_table.css";
                        @import "<?php echo base_url() ?>commons/tablas/extras/TableTools/media/css/TableTools.css";
        </style>
<style type="text/css">
.reprobado{
        -webkit-box-shadow: -8px -8px 10px -7px rgba(24,37,102,1);
-moz-box-shadow: -8px -8px 10px -7px rgba(24,37,102,1);
box-shadow: -8px -8px 10px -7px rgba(24,37,102,1);
background: rgba(235,233,249,1);
background: -moz-linear-gradient(left, rgba(235,233,249,1) 0%, rgba(216,208,239,1) 16%, rgba(206,199,236,1) 87%, rgba(193,191,234,1) 100%);
background: -webkit-gradient(left top, right top, color-stop(0%, rgba(235,233,249,1)), color-stop(16%, rgba(216,208,239,1)), color-stop(87%, rgba(206,199,236,1)), color-stop(100%, rgba(193,191,234,1)));
background: -webkit-linear-gradient(left, rgba(235,233,249,1) 0%, rgba(216,208,239,1) 16%, rgba(206,199,236,1) 87%, rgba(193,191,234,1) 100%);
background: -o-linear-gradient(left, rgba(235,233,249,1) 0%, rgba(216,208,239,1) 16%, rgba(206,199,236,1) 87%, rgba(193,191,234,1) 100%);
background: -ms-linear-gradient(left, rgba(235,233,249,1) 0%, rgba(216,208,239,1) 16%, rgba(206,199,236,1) 87%, rgba(193,191,234,1) 100%);
background: linear-gradient(to right, rgba(235,233,249,1) 0%, rgba(216,208,239,1) 16%, rgba(206,199,236,1) 87%, rgba(193,191,234,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ebe9f9', endColorstr='#c1bfea', GradientType=1 );
    }    
</style>
<script type="text/javascript">
    var t=jQuery.noConflict();
            t(document).ready(function() {
                t('#example').dataTable( {
                    "sPaginationType": "full_numbers",
                  "sDom": 'T C lfrtip', 
                    "oTableTools": { 
                    "sSwfPath": "<?php echo base_url() ?>commons/tablas/extras/TableTools/media/swf/copy_csv_xls_pdf.swf", 
                    "aButtons": [ 
                    "xls",
                    "pdf",]}, 
                    
               } );
    } );


    /**
     *
     * @param {jqObject} the field where the validation applies
     * @param {Array[String]} validation rules for this field
     * @param {int} rule index
     * @param {Map} form options
     * @return an error string if validation failed
     */
    function checkHELLO(field, rules, i, options) {
        if (field.val() != "HELLO") {
            // this allows to use i18 for the error msgs
            return options.allrules.validate2fields.alertText;
        }
    }
</script>


<script>
var t = jQuery.noConflict();
function imprimirExp(){
alert("imprimir");
            t.ajax({
                type: 'POST',
                url: '<?php echo base_url(). "admin.php/promocion/imprimirExpediente/" ?>' ,
                data: 'ide_lec=' + 1,
                dataType: 'html',
                success: (function(data) {
                    
                })
            });

}
</script>


<form name="form1" class="well form-horizontal span8" action="<?php echo base_url() . 'admin.php/promocion/imprimirPromocion' ?>" method="post" target="_blank">
    <legend>HISTORIAL ACADEMICO DEL ESTUDIANTE</legend>
    <h4>ESTUDIANTE:<?php echo $materias[0]['nombres'] ?><br>CARRERA: <?php echo $materias[0]['carrera'] ?></h4>


    <div class="tabbable">
        <ul class="nav nav-tabs">
            <li><a href="#1" data-toggle="tab">Datos Generales</a></li>
            <li class="active"><a href="#2" data-toggle="tab">Expediente</a></li>
        </ul>
        <div class="tab-content">
            <?php foreach ($estudiante as $i => $est) { ?>
                <div class="tab-pane " id="1">
                    <div class="control-group">
                        <label class="control-label" for="input01">N&uacute;mero de Identificaci&oacute;</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="cedula_pers" value= "<?php echo $est['cedula_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select01">Tipo de Documento</label>
                        <div class="controls">

                            <select id="select01"  name="tipo_doc_pers">

                                <option value= "0" <?php echo ($est['tipo_doc_pers'] == 0 ? " selected" : " "); ?>>CEDULA</option>
                                <option value= "1" <?php echo ($est['tipo_doc_pers'] == 1 ? " selected" : " "); ?>>PASAPORTE</option>
                                <option value= "2" <?php echo ($est['tipo_doc_pers'] == 2 ? " selected" : " "); ?>>CARNE DE REFUGIADO</option>
                            </select>

                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label" for="input02">Nombre Completos</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="nombre_pers" value= "<?php echo $est['nombre_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input03">Apellidos </label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="apellido_pers" value= "<?php echo $est['apellido_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input04">Nacionalidad </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="nacionalidad_pers" value= "<?php echo $est['nacionalidad_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input15">Provincia </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="provincia_pers" value= "<?php echo $est['provincia_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input05">Ciudad </label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="ciudad_pers" value= "<?php echo $est['ciudad_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input06">Direccion del Domicilio</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="direccion_pers" value= "<?php echo $est['direccion_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input07">Referencia del Domicilio</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="refer_domic_pers" value= "<?php echo $est['refer_domic_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input08">Tipo de Discapacidad</label>
                        <div class="controls">
                            <input type="text" class="input-medium span4"  name="tipo_discap_pers" value= "<?php echo $est['tipo_discap_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input09">Carn&eacute; del CONADIS</label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="conadis_pers" value= "<?php echo $est['conadis_pers']; ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input010">Porcentaje de Discapacidad</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="porc_disc_pers" value= "<?php echo $est['porc_disc_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="select01">Sexo</label>
                        <div class="controls">

                            <select id="select01"  name="sexo_pers">
                                <option <?php echo ($est['sexo_pers'] == "HOMBRE" ? " selected" : " "); ?>>HOMBRE</option>
                                <option <?php echo ($est['sexo_pers'] == "MUJER" ? " selected" : " "); ?>>MUJER</option>
                            </select>

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select02">Estado Civil</label>
                        <div class="controls">

                            <select id="select02"  name="estado_civil_pers">
                                <option <?php echo ($est['estado_civil_pers'] == "SOLTERO(A)" ? " selected" : " "); ?>>SOLTERO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "CASADO(A)" ? " selected" : " "); ?>>CASADO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "UNION LIBRE" ? " selected" : " "); ?>>UNION LIBRE</option>
                                <option <?php echo ($est['estado_civil_pers'] == "DIVORCIADO(A)" ? " selected" : " "); ?>>DIVORCIADO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "VIUDO(A)" ? " selected" : " "); ?>>VIUDO(A)</option>
                                <option <?php echo ($est['estado_civil_pers'] == "ECLECIASTICO(A)" ? " selected" : " "); ?>>ECLECIASTICO(A)</option>


                            </select>

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="select12">Autodefinici&oacute;</label>
                        <div class="controls">

                            <select id="select02"  name="autodefin_pers">
                                <option <?php echo ($est['autodefin_pers'] == "NEGRO" ? " selected" : " "); ?>>NEGRO</option>
                                <option <?php echo ($est['autodefin_pers'] == "MULATO" ? " selected" : " "); ?>>MULATO</option>
                                <option <?php echo ($est['autodefin_pers'] == "AFROECUATORIANO" ? " selected" : " "); ?>>AFROECUATORIANO</option>
                                <option <?php echo ($est['autodefin_pers'] == "INDIGENA" ? " selected" : " "); ?>>INDIGENA</option>
                                <option <?php echo ($est['autodefin_pers'] == "MESTIZO" ? " selected" : " "); ?>>MESTIZO</option>
                                <option <?php echo ($est['autodefin_pers'] == "MONTUBIO" ? " selected" : " "); ?>>MONTUBIO</option>
                                <option <?php echo ($est['autodefin_pers'] == "BLANCO" ? " selected" : " "); ?>>BLANCO</option>
                                <option <?php echo ($est['autodefin_pers'] == "OTRO" ? " selected" : " "); ?>>OTRO</option>


                            </select>

                        </div>
                    </div>


                    <div class="control-group">
                        <label class="control-label" for="select03">Fecha de Nacimiento</label>
                        <div class="controls">
                            <input type="text" class="input-medium "  id="datepicker" name="fecha_nac_pers" value="<?php echo date("m/d/Y", strtotime($est['fecha_nac_pers'])); ?>">

                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input08">N&uacute;mero de tel&eacute;fono</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="fono_pers" value= "<?php echo $est['fono_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input09">N&uacute;mero de celular</label>
                        <div class="controls">
                            <input type="text" class="input-medium span2"  name="celular_pers" value= "<?php echo $est['celular_pers']; ?>">

                        </div>
                    </div>

                    <div class="control-group">
                        <label class="control-label" for="input10">Correo Electr&oacute;nico Institucional</label>
                        <div class="controls">
                            <input type="text" class="input-medium span3"  name="email_inst_pers" value= "<?php echo $est['email_inst_pers']; ?>">
                        </div>
                    </div>
                    <div class="control-group">
                        <label class="control-label" for="input11">Fotograf&iacute;a</label>
                        <div class="controls">
                            <img src="<?php echo $est['foto_pers']; ?>" width="88" height="99" alt="itss1"/>
                        </div>
                    </div>

 

                </div>
               

            <?php } ?>
            <div class="tab-pane active" id="2">
 
                <div id="tablamatriculai" >
                    <table id="example" class="table table-bordered table-striped table-condensed">
                        <thead>
                            <tr>

                                <th>NIVEL</th>
                                <th>MATERIAS</th>
                                <th>BIM1</th>
                                <th>BIM2</th>
                                <th>REMD</th>
                                <th>SUMA TOTAL</th>
                                <th>SUMA LETRAS</th>
                                <th>CREDITOS</th>
                                <th>ASIST 1B</th>
                                <th>ASIST 2B</th>
                                <th>TOTAL ASIST</th>
                                <th>COND NOTAS</th>
                                <th>COND ASIST</th>
                                <th>DOCENTE</th>
                                <th>SEMESTRE</th>
                                <th>MATRICULA</th>

                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $nro_filas = 0;
                            $suma=0;
                            $nro_materias=0;
                            $excede_m=array();

                            if (!empty($materias)) {
                                $nro_filas = count($materias);
                                
                                
                                foreach ($materias as $i => $mat) {
                                    $css=($mat['color']==1?' class="reprobado"':"");
                                      //if ($mat['estado_cur'] == 4 OR $mat['estado_cur'] == 5 OR $mat['estado_cur'] == 6) {

                                    ?>
                                    <tr>
                                        <td <?php echo $css ?>><?php echo ($mat['codigo_cic']) ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['nombre_mat'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['total1'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['total2'] ?></td>
                                        <td <?php echo $css ?>><?php echo ($mat['suple_cal']>0?$mat['suple_cal']:'-') ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['nota']; ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['letra_n'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['creditos_mat'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['asiste1_cal'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['asiste2_cal'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['asiste'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['cond_notas'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['cond_asiste'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['docente'] ?></td>
                                        <td <?php echo $css ?>><?php echo $mat['semestre'] ?></td>
                                        <td <?php echo $css ?>><?php echo ($mat['veces_repite']==1?"PRIMERA"
                                            :($mat['veces_repite']==2?"SEGUNDA":($mat['veces_repite']==3?"TERCERA":"CUARTA")));
                                            if ($mat['veces_repite']>=3){
                                                $aux=array(
                                                    "mat"=>$mat['nombre_mat'],
                                                    "rep"=>$mat['veces_repite']);
                                                $excede_m[]=$aux;

                                            } 

                                            if(strtolower($mat['cond_notas'])=="aprobado" && strtolower($mat['cond_asiste'])=="aprobado"){
                                                $suma+=$mat['nota'];
                                                $nro_materias++;

                                            }

                                            ?></td>

        
                                    </tr>
                                    <?php
                                
                                }
                                }
                            
                            ?>
                                    
                        </tbody>
                    </table>        
                </div>     




            </div>  <!--fin tabulador 3 -->
        </div>
    </div>

    <?php if (count($excede_m)>0) { 
        $tit="";
        //echo ('<p><label class="control-label">NO SE PUEDE IMPRIMIR EXPEDIENTE</label></ p>');
        $css=("class='reprobado'");
        echo ("<table width='60%'><thead><tr> <th>MAT. REPITE</th><th>MATRICULA</th></tr></thead> ");

                               
        foreach ($excede_m as $key => $row) {
            echo ("<tr> <td ".$css." >".$row["mat"]."</td><td ".$css.">".$row["rep"]."</td></tr>");
            
                
        }
        echo ("</table>"); 
    } ?>
   <div class="controls">
        <label class="control-label" for="input08">Promedio:</label>
        <div class="controls">
            <input type="text" class="input-medium span1"  name="promed" readonly="true" value= "<?php echo ((!empty($materias) && $nro_materias)?(round($suma/$nro_materias,2)):0); ?>">

        </div>
        <a href="<?php echo base_url() ."admin.php/promocion/imprimirExpediente/".$semestres[0]['ide_lec']."/".$semestres[0]['codigo_cic']."/".$semestres[0]['seccion']."/".$semestres[0]['paralelo']; ?>" target="_blank">
            <img src="<?php echo base_url(); ?>commons/images/expediente.jpg" ></a>
        <a href="#" onclick="document.form1.submit()" >
            <img src="<?php echo base_url(); ?>commons/images/certificado.jpg"></a>
        <select name="ciclos" id="idciclo" class="span1">
        <?php 
            foreach ($semestres as $key => $row) {
                echo "<option value='".$row['ide_cic']."'>".$row['codigo_cic']."</option>";
                
            }
         ?>

            
        </select>
        



        <a href="<?php echo base_url() . "admin.php/promocion/inicio/".$ide_car."/".$ide_pen ?>">
            <img src="<?php echo base_url(); ?>commons/images/boton_volver.gif"></a>

    </div>   
    <fieldset>
        <div class="control-group"> 
            <div class="controls">

            </div>
        </div >
    </fieldset>

    








</form>


